﻿#region Using Statements

using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Content.Pipeline;
using Microsoft.Xna.Framework.Content.Pipeline.Graphics;
using Microsoft.Xna.Framework.Content.Pipeline.Processors;
using Microsoft.Xna.Framework.Content.Pipeline.Serialization.Compiler;
using MilwormsGameData;

#endregion

namespace MilwormsGameContentPipeline
{
    [ContentTypeWriter]
    public class PlayerWriter : MilwormsGameWriter<Player>
    {
        FightingCharacterWriter fightingCharacterWriter = null;

        protected override void Initialize(ContentCompiler compiler)
        {
            fightingCharacterWriter = compiler.GetTypeWriter(typeof(FightingCharacter))
                as FightingCharacterWriter;

            base.Initialize(compiler);
        }

        protected override void Write(ContentWriter output, Player value)
        {
            output.WriteRawObject<FightingCharacter>(value as FightingCharacter,
                fightingCharacterWriter);
            output.Write(value.IntroductionDialogue);
            output.Write(value.JoinAcceptedDialogue);
            output.Write(value.JoinRejectedDialogue);
            output.Write(value.ActivePortraitTextureName);
        }

        public override string GetRuntimeType(TargetPlatform targetPlatform)
        {
            return typeof(MilwormsGameData.Player).AssemblyQualifiedName;
        }

        public override string GetRuntimeReader(TargetPlatform targetPlatform)
        {
            return typeof(MilwormsGameData.Player.PlayerReader).AssemblyQualifiedName;
        }
    }
}
